package org.jpass.dc.common.bean;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.GenericGenerator;

/**
 * UUID primary key.
 * 
 * @author long
 */
@MappedSuperclass
public abstract class UUIDSupport {

    protected String id;
    
    /**
     * GeneratedValue，定义该标识符的生成策略
     * GenericGenerator，定义一个Hibernate特定的id生成器, 使用uuid生成主键
     * @return
     */
    @Id
    @Column(nullable=false, updatable=false, length=32)
    @GenericGenerator(name="system-uuid", strategy="uuid")
    @GeneratedValue(generator="system-uuid")
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

}
